package pattern.proxy.example1;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class ProxyClass implements InvocationHandler {

	Object obj;

	public ProxyClass(Object o) {
		obj = o;
	}

	public Object invoke(Object proxy, Method method, Object[] args)
			throws Throwable {
		Object result = null;
		try {
			System.out.println("before the method is called ");
			result = method.invoke(obj, args);
		} catch (Exception eBj) {
		} finally {
			System.out.println("after the method is called");
		}
		return result;
	}
}
